/*---------- vfs.h ----------*/
#pragma once
#include "type.h"
#include <stdint.h>


// 通用VFS结构
typedef struct vfs_inode {
    uint32_t i_ino;         // inode 编号
    uint32_t i_size;        // 文件大小
    uint32_t i_cluster;     // FAT32 使用的簇号
    void*    i_private;     // 私有数据指针
} vfs_inode_t;

typedef struct {
    int (*open)(vfs_inode_t* inode);
    ssize_t (*read)(vfs_inode_t* inode, void* buf, size_t size, off_t offset);
    ssize_t (*write)(vfs_inode_t* inode, const void* buf, size_t size, off_t offset);
    int (*close)(vfs_inode_t* inode);
} vfs_file_operations;

typedef struct vfs_filesystem {
    const char* name;
    uint8_t*    base_addr;
    vfs_file_operations ops;
    void*       fs_private;
} vfs_filesystem_t;

// 内核内存接口
void* kmalloc(size_t size);
void  kfree(void* ptr);

#include "fat32.h"
#include "overlayfs.h"